package com.example.myprojectoffeixue;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.localization.GlobalValue;

/**
 * Created by ASUS on 2017/3/6.
 */
public class LocationDialog extends Activity {
        private SharedPreferences sp;
        MyApplication m;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_location_dialog);
            info();
        }

        public void info() {
            m= (MyApplication) getApplication();
            TextView tv_qd= (TextView) findViewById(R.id.tv_dialog);
            TextView tv_exit= (TextView) findViewById(R.id.tv2_dialog);

            tv_exit.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.d("关闭本地连接","关闭");
                    for(int i = 0; i< GlobalValue.mGateway.msocket.size(); i++) {
                        GlobalValue.mGateway.close();
                    }
                    m.udp.close();
                    GlobalValue.tcpclient=null;
                    GlobalValue.mGateway.objectlist.clear();
                    GlobalValue.mGateway.msocket.clear();
                    GlobalValue.mGateway.MacSocke.clear();
                    finish();
                }
            });

            tv_qd.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    MyApplication.flag8=1;
                    m.c.close();
                    m.flag6 = false;
                    Log.d("关闭云端连接","关闭");
                    finish();
                }
            });









        }


}

